<template>
	<view class="con">
		<view class="main">
			<view class="main_v1">{{info.title}}</view>
      <view class="main_v4">{{info.time}}</view>
      <view class="main_v3">
        <mp-html :content="info.content" />
      </view>
      
		</view>
	</view>
</template>

<script>
  import {
    getArticleInfo, //信息详细
  } from '@/request/api.js'
   import uParse from '@/components/u-parse/u-parse.vue'
	export default {
		data() {
			return {
        openid: uni.getStorageSync('openid'), //获取缓存的openid
				id:'',//详情id
        title:'',//详情标题
        info:{} ,//返回内容
			};
		},
    onLoad(options) {
      console.log('单页2-接收参数')
      console.log(options)
      this.id = options.id
      this.title = options.title
      // uni.setNavigationBarTitle({
      //   title: options.title// 新标题内容
      // });
      // this.getArticleInfoFun() //获取协议
    },
    onShow(){
      this.getArticleInfoFun() //获取协议
      this.isLogin = uni.getStorageSync('isLogin') || 1
      if (this.isLogin === 1) {
      	console.log('未授权登录')
        uni.hideShareMenu()
      }else{
        uni.showShareMenu({
        	withShareTicket: true,
        	menus: ["shareAppMessage", "shareTimeline"]
        })
      }
    },
    methods:{
      getArticleInfoFun(){
        getArticleInfo(this.openid,this.id).then(res=>{
          console.log('获取信息详细')
          console.log(res)
          this.info = res.data[0]
          uni.setNavigationBarTitle({
            title: this.info.title// 新标题内容
          });
        })
      },
    },
    // 分享微信好友
    onShareAppMessage(event) {
    	console.log(event);
        return {
        	title: '陌上未来，没有概率做了就赚',
        	path: '/pages/index/index?pid=' + uni.getStorageSync('userInfo').id,
        	// imageUrl: imageUrl
        }
    },
    //分享到朋友圈
    onShareTimeline(event) {
    	console.log(event);
    	return {
    		title: '陌上未来，没有概率做了就赚',
    		path: '/pages/index/index?pid=' + uni.getStorageSync('userInfo').id,
    		query: 'pid=' + uni.getStorageSync('userInfo').id,
    		// imageUrl: imageUrl
    	}
    },
    
    
	}
</script>

<style scoped lang="scss">
.main{
	width: 100%;
	box-sizing: border-box;
	height: auto;
	.main_v1{
		line-height: 58rpx;
		color: rgba(16,16,16,1);
		font-size: 48rpx;
		margin-bottom: 20rpx;
	}
	.main_v2{
		display: block;
		width: 100%;
		height: auto;
		margin-bottom: 36rpx;
	}
	.main_v3{
		width: 100%;
		line-height: 40rpx;
		color: rgba(16,16,16,1);
		font-size: 28rpx;
    /deep/ image{
      display: block !important;
       width: 100% !important;
       margin-bottom: 10rpx !important;
    }
	}
  .main_v4{
    width: 100%;
    line-height: 40rpx;
    color: #666;
    font-size: 28rpx;
    margin-bottom: 60rpx;
  }
}
</style>
